github.com/turbot/steampipe@v1.7.0-rc.0.0.20240517123944-7cef272d4458/tests/manual_testing/many controls/queries/q17.sql (about)

     1  with all_stages as (
     2      select
     3          name as stage_name,
     4          'arn:' || partition || ':apigateway:' || region || '::/apis/' || rest_api_id || '/stages/' || name as arn,
     5          method_settings -> '*/*' ->> 'LoggingLevel' as log_level,
     6          title,
     7          region,
     8          account_id
     9      from
    10          aws_api_gateway_stage
    11      union
    12      select
    13          stage_name,
    14          'arn:' || partition || ':apigateway:' || region || '::/apis/' || api_id || '/stages/' || stage_name as arn,
    15          default_route_logging_level as log_level,
    16          title,
    17          region,
    18          account_id
    19      from
    20          aws_api_gatewayv2_stage
    21  )
    22  select
    23      -- Required Columns
    24      arn as resource,
    25      case
    26          when log_level is null or log_level = 'OFF' then 'alarm'
    27          else 'ok'
    28          end as status,
    29      case
    30          when log_level is null or log_level = 'OFF' then title || ' logging not enabled.'
    31          else title || ' logging enabled.'
    32          end as reason,
    33      -- Additional Dimensions
    34      region,
    35      account_id
    36  from
    37      all_stages;